﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace devtm.Editor.TypeSelector
{
    public class ValuesParameters : devtm.Collections.TableCollection<ValueParameter, Guid>
    {

        private ObjectContainer _parent;

        public ValuesParameters(ObjectContainer parent)
            : base(c => c.Key)
        {
            this._parent = parent;
            //this.CollectionChanged += ValuesParameters_CollectionChanged;
        }


        public ObjectContainer Parameters { get { return _parent; } }


        public ValueParameter AddParameter()
        {
            var p = new ValueParameter(_parent);
            Add(p);
            
            return p;
        }

        //void ValuesParameters_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        //{
        //    if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
        //    {

        //        foreach (ValueParameter item in e.NewItems)
        //            item.PropertyChanged += p_PropertyChanged;
                
        //    }
        //    else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
        //    {
              
        //        foreach (ValueParameter item in e.OldItems)
        //            item.PropertyChanged -= p_PropertyChanged;
                
        //    }
        //}

        //void p_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        //{
          
        //}

    }
}
